import { createVNode, render, nextTick } from "vue";

import ImageCutting from "./ImageCutting.vue";

/**
 * 打开页面
 */
export function show() {
  let imageCuttingVNode = createVNode(ImageCutting, {
    /**
     * 当成功之后
     */
    onSubmit(e: File) {
    },
    /**
     * 页面关闭
     */
    onClose() {
      render(null, rootDom);
      rootDom.remove();
    }
  });


  let rootDom = document.createElement("div");
  render(imageCuttingVNode, rootDom);
  document.body.append(rootDom);

  nextTick(() => {
    if (imageCuttingVNode && imageCuttingVNode.component) {
      imageCuttingVNode.component.exposed?.show(require("@/assets/view/Login/bg.jpg"), 1, 1)
    }
  })
}